<!--suppress ALL -->
<include file="./Template/header.html" />
<link rel="stylesheet" type="text/css" href="/Template/css/evaluate.css?v=1">
<script type="text/javascript">
            $(function() {

                //初始化页面配置
                document.title = "免费评估";

                var app = new Vue({
                    el: '#container',
                    methods: {
                        cancel: function() {
                            window.location.href = "/wechat/home";
                        },
                        booking: function() {

                            var name = $("input[name=name]").val();
                            var sex = $("select[name=sex]").val();
                            var age = $("input[name=age]").val();
                            var mobile = $("input[name=mobile]").val();
//                            var idcardNumber = $("input[name=idcardNumber]").val();
                            var address = $("input[name=address]").val();
                            var disease = $("input[name=disease]").val();
                            var note = $("input[name=note]").val();
//                            var diseaseId = $("select[name=diseaseId]").val();


                            if(isNullOrEmpty(name)) {
                                alert("请填写姓名");
                                return false;
                            }

                            if(isNullOrEmpty(sex)) {
                                alert("请选择性别");
                                return false;
                            }

                            if(isNullOrEmpty(age)) {
                                alert("请填写年龄");
                                return false;
                            }

                            if(isNullOrEmpty(mobile)) {
                                alert("请填写联系方式");
                                return false;
                            }

                            if(isNullOrEmpty(disease)) {
                                alert("请填写病症");
                                return false;
                            }

                            if(!checkPhone(mobile)) {
                                alert("手机号位数不对");
                                return false;
                            }
                            if(isNullOrEmpty(address)) {
                                alert("请填写地址");
                                return false;
                            }
//                            if(isNullOrEmpty(idcardNumber)) {
//                                alert("请填写身份证号");
//                                return false;
//                            }
//
//                            if(idcardNumber.length != 18) {
//                                alert("身份证号位数不对");
//                                return false;
//                            }


                            if(!confirm("请确认您的信息已填写完整，是否继续？")){
                                return false;
                            }
                            $.ajax({
                                url:"/wechat/evaluate/evaluate",
                                type:"post",
                                data:{
                                    //evaluateId: "{$evaluate.evaluate_id}",
                                    name: name,
                                    sex: sex,
                                    mobile: mobile,
                                    age: age,
                                    disease: disease,
                                    address: address,
                                    note: note,
//                                    diseaseId: diseaseId
                                },
                                dataType:"JSON",
                                beforeSend:function(){
                                    $("#loadingToast").show();
                                },
                                complete:function(){
                                    $('#loadingToast').hide();
                                },
                                success:function(data){
                                    if(data.code != 200) {
                                        alert(data.msg);
                                        return false;
                                    }
                                    alert('申请成功')
                                    window.location.href = "/wechat/home";
                                },
                            })



                        }
                    }
                })

                $("select[name=sex]").change(function() {
                    var value = $(this).val();
                    $(this).prev().val(value);
                });



            });


        </script>
        <if condition="$info['status'] eq '-1'">
            <div class="hint-info">
                免费评估请求已经提交，我们将尽快联系您。
            </div>
        </if>

        <div class="container" id="container">
            <div class="edit-content">
                <input type="text" style="display: none;" name="messageId" value="{$info.evaluate_id}">
                <input type="text" style="display: none;" name="customerId" value="{$customerId}">
                <div class="item">
                    <span>患者姓名</span>
                    <input type="text" name="name" value="{$info.name}" placeholder="请填写患者的真实姓名">
                    <img class="icon-right" src="/Template/images/icon-right.png" alt="">
                </div>
                <div class="item">
                    <span>患者性别</span>
                    <input id="gender" type="text" value="{$info.sex}" readonly placeholder="请选择患者的性别">
                    <select name="sex">
                        <option value="0">请选择患者性别</option>
                        <option value="男">男</option>
                        <option value="女">女</option>
                    </select>
                    <img class="icon-right gender" src="/Template/images/icon-right.png" alt="">
                </div>
                <div class="item">
                    <span>患者年龄</span>
                    <input type="text" name="age" value="{$info.age}" placeholder="请填写患者年龄">
                    <img class="icon-right" src="/Template/images/icon-right.png" alt="">
                </div>
                <!--div class="item">
                    <span>病症</span>
                    <input id="diseaseId" type="text" value="" readonly placeholder="请选择您的症状">
                    <select name="diseaseId">
                        <option value="">请选择</option>
                        {:getCategorySelectOptionHtml($info['category_id'], 0)}
                    </select>
                    <img class="icon-right disease" src="/Template/images/icon-right.png" alt="">
                </div-->
                <div class="item">
                    <span>联系电话</span>
                    <input type="text" name="mobile" value="{$info.mobile}" placeholder="请填写的电话号码">
                    <img class="icon-right" src="/Template/images/icon-right.png" alt="">
                </div>
                <div class="item">
                    <span>病症</span>
                    <input type="text" name="disease" value="{$info.disease}" placeholder="请填写详细病症">
                    <img class="icon-right" src="/Template/images/icon-right.png" alt="">
                </div>
                <!--div class="item">
                    <span>患者身份证号</span>
                    <input type="text" name="idcardNumber" placeholder="请填写身份证号">
                    <img class="icon-right" src="/Template/images/icon-right.png" alt="">
                </div-->
                <div class="item">
                    <span>详细地址</span>
                    <input type="text" name="address" value="{$info.address}" placeholder="请填写详细地址">
                    <img class="icon-right" src="/Template/images/icon-right.png" alt="">
                </div>
                <div class="item">
                    <span>备注</span>
                    <input type="text" name="note" value="{$info.note}" placeholder="其他请求可写在这里">
                    <img class="icon-right" src="/Template/images/icon-right.png" alt="">
                </div>
            </div>
            
            <div class="operation">
                <if condition="$info['status'] neq '-1'">
                    <button class="cancel" v-on:click="cancel">取消</button>
                    <button class="confirm" v-on:click="booking">确认</button>
                </if>
                <if condition="$info['status'] eq '-1'">
                    <button class="cancel" v-on:click="cancel">返回</button>
                </if>
            </div>
        </div>
        <include file="./Template/footer.html" />

    </title>
</head>
<body>

</body>
</html>